package com.yiquan.search.controller;

import com.yiquan.search.entity.Video;
import com.yiquan.search.service.RecommendService;
import entity.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * 推荐
 *
 * @author Tyrone
 * @date 2022/3/9 12:20
 */
@RestController()
@RequestMapping("/recommend")
public class RecommendController {


    @Autowired
    private RecommendService recommendService;


    /**
     * 根据用户推荐不同的视频
     * 1.有用户id则传入用户id，根据用户id推荐视频
     * 2.如果没有用户id传入则默认最火的视频
     *
     * @param userId
     * @return
     */
    @GetMapping("/getVideo")
    public Result getRecommendController(@RequestParam("userId") String userId) {
        return new Result(recommendService.getRecommendVideo(userId));
    }
}
